var e = require;
var t = module;
var o = exports;
var n = o;
Object.defineProperty(n, "__esModule", {value: !0});
var i = e("AssetsMap"),
    a = e("BundleManager"),
    r = e("GameSceneMediator"),
    s = e("DialogView"),
    c = e("BundleNames"),
    l = e("Loading"),
    d = e("LoadingView"),
    u = (function () {
        function e() {}
        return (
            Object.defineProperty(e, "instance", {
                get: function () {
                    return e._instance || (e._instance = new e()), e._instance;
                },
                enumerable: !1,
                configurable: !0
            }),
            (e.prototype.createNodeByPreloading = function (e, t) {
                var o = a.default.instance.getBundle(e);
                if (!o) return game.error("UIManager", "createNodeByPreloading error,bundle:" + e + "  unloaded"), null;
                var n = o.get(t, cc.Prefab);
                if (!n || null == n)
                    return game.error("UIManager", "createNodeByPreloading error,url: " + t + "  unloaded"), null;
                if (!(n instanceof cc.Prefab))
                    return game.error("UIManager", "createNodeByPreloading error,url: " + t + "  not prefab"), null;
                var i = cc.instantiate(n);
                return i && null != i
                    ? i
                    : (game.error("UIManager", "createNodeByPreloading fail,url: " + t + "  create node is null"),
                      null);
            }),
            (e.prototype.replaceModuleView = function (e, t, o) {
                game.appFacade.retrieveMediator(r.default.NAME).replaceModuleView(e, t, o || null);
            }),
            (e.prototype.showDialog = function (e, t, o, n) {
                var a = this.createNodeByPreloading(
                    c.default.Resources,
                    i.default.ResourceBundle.prefabs.assetsList.DialogView
                );
                a.zIndex = cc.macro.MAX_ZINDEX;
                var r = a.getComponent(s.default);
                (r.text = e),
                    (r.showCancel = t),
                    (r.cancelCallback = o),
                    (r.confirmCallback = n),
                    cc.director.getScene().getChildByName("Canvas").addChild(a);
            }),
            (e.prototype.showLoadResView = function (e, t, o) {
                var n = this.createNodeByPreloading(
                    c.default.Resources,
                    i.default.ResourceBundle.prefabs.assetsList.LoadingView
                );
                n.zIndex = cc.macro.MAX_ZINDEX;
                var a = n.getComponent(d.default);
                (a.bundleNames = e),
                    (a.assetsModules = t),
                    (a.successCallback = o),
                    cc.director.getScene().getChildByName("Canvas").addChild(n);
            }),
            (e.prototype.showToast = function (e, t) {
                void 0 === t && (t = 1);
                var o = game.UIManager.instance.createNodeByPreloading(
                    c.default.Resources,
                    i.default.ResourceBundle.prefabs.assetsList.Toast
                );
                (o.zIndex = cc.macro.MAX_ZINDEX),
                    (o.getComponent(game.BaseComponent).param = {text: e, duration: t}),
                    cc.director.getScene().getChildByName("Canvas").addChild(o);
            }),
            (e.prototype.showLoading = function (e, t) {
                void 0 === e && (e = 5), void 0 === t && (t = null);
                var o = game.UIManager.instance.createNodeByPreloading(
                    c.default.Resources,
                    i.default.ResourceBundle.prefabs.assetsList.Loading
                );
                (o.zIndex = cc.macro.MAX_ZINDEX),
                    (o.getComponent(game.BaseComponent).param = {outTime: e, timeOutCallFunc: t}),
                    cc.director.getScene().getChildByName("Canvas").addChild(o);
            }),
            (e.prototype.hideLoading = function () {
                l.default.oldLoadingView &&
                    (l.default.oldLoadingView.getComponent(l.default).customerDestory(),
                    (l.default.oldLoadingView = null));
            }),
            (e._instance = null),
            e
        );
    })();
n.default = u;
